<template>
	<view class="yp">
		<!-- 发布内容部分 -->
		<Card ref='cards' :opt="opt" :SelJson.sync='SelJson' @Send='onChangePageNum'></Card>


		<!-- 占位 -->
		<view style="height: 120rpx;" v-if="this.opt.UserId"></view>
		<!-- 底部按钮 -->
		<view class="foot-btn" v-if="!isSelfAccount">
			<button class="cu-btn bg-grey" @click="onAttent">关注</button>
			<button class="cu-btn bg-red" @click="gotoDoctor">私聊</button>
		</view>


	</view>
</template>

<script>
	import Card from './components/card.vue';
	export default {
		name: '',
		components: {
			Card
		},
		data() {
			return {
				opt: '', // 页面传参数据
				SelJson: {
					pageNum: 0,
					pageSize: 10
				}
			};
		},
		computed: {
			isSelfAccount() {
				if (this.opt.UserId) {
					return this.opt.UserId === this.$pub.getStorageSync('UserInfo')._id
				}
				return true
			}
		},
		onLoad(opt) {
			this.opt = opt;
		},
		onReachBottom() {
			// this.SelJson.pageNum = this.SelJson.pageNum + 1
			this.$refs.cards.SelArticle('分页')
		},
		methods: {
			onChangePageNum(value) {
				this.SelJson.pageNum = value
			},
			onAttent() {
				this.$pub.Toast('功能开发中~')

			},
			gotoDoctor() {
				console.log()
				this.$pub.naviTo(`/pages/Chat/ChatWindow/ChatWindow?PersionId=${this.opt.UserId}`)
				// this.$pub.Toast('功能开发中~')
			}
		}
	};
</script>

<style scoped lang="less">
	.foot-btn {
		background-color: #fff;
		position: fixed;
		bottom: 0;
		width: 100%;
		display: flex;
		box-sizing: border-box;
		padding: 20rpx;
		height: 120rpx;

		.cu-btn {
			flex: 1;
			margin: 0 10rpx;
			border-radius: 100upx;
			height: 80upx;
			background-color: skyblue;
			transition: 1s;
		}
	}
</style>
